<!DOCTYPE html>
<html lang="en">
	<include file="Public:header" />
	<include file="Public:page_css" />
	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
		<include file="Public:nav" />
		<div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-12">
                <h2>管理员列表</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:U('Index/index')}"><i class="fa fa-home"></i> 主页</a>
                    </li>
                    <li>
                        <a>管理员管理</a>
                    </li>
                    <li>
                        <strong>管理员列表</strong>
                    </li>
                </ol>
            </div>              
        </div>
        <br />
        <div class="row">
			<div class="col-sm-12">
				<div class="col-sm-1">
					<div class="input-group">
			            <a href="{:U('Sys/admin_list_add')}" class="btn btn-primary">添加管理员</a>
			        </div>
			    </div>
			    <div class="col-sm-3">
				    <form name="admin_list_sea" class="form-search" method="post" action="__URL__/admin_list">
						<div class="input-group">
				            <input type="text" name="val" id="val" class="form-control" value="{$testval}" placeholder="输入需查询的管理员名"> 
				            <span class="input-group-btn"> 
				            	<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button> 
				            </span>
				        </div>
				    </form>
			    </div>
			</div>
		</div>
		<br />
		<br />
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5><i class="fa fa-tasks"></i> 管理员列表</h5>
					</div>
					<div class="ibox-content">
					<form id="leftnav" name="leftnav" method="post" action="" >
                    <input type="hidden" name="checkk" id="checkk" value="1" />
						<table class="table table-bordered">
							<thead>
								<tr class="long-tr">
									<th>ID</th>
									<th width="8%">登录管理员名</th>
									<th width="8%">真实姓名</th>
									<th width="8%">头像</th>
									<th width="12%">邮箱</th>
									<th width="10%">管理员组</th>
									<th width="10%">电话号码</th>
									<th width="8%">登陆次数</th>
									<th width="10%">IP地址</th>
									<th width="9%">状态</th>
									<th width="15%">操作</th>
								</tr>
							</thead>
							<tbody>
								<foreach name="admin_list" item="v">
									<tr class="long-td">
										<td>{$v.admin_id}</td>
										<td>{$v.admin_username}</td>
										<td>{$v.admin_realname}</td>
										<td><img class="img-circle" src="__ROOT__/Uploads/{$v.admin_img|default='userImg.jpg'}" style="width:60px;height:60px" onerror="this.src='__PUBLIC__/Admin/img/touxiang_default.png'"/></td>
										<td>{$v.admin_email}</td>
										<td>{$v.group}</td>
										<td>{$v.admin_tel}</td>
										<td>{$v.admin_hits}</td>
										<td>{$v.admin_ip}</td>
										<td>
											<if condition='$v[admin_open] eq 1'>
												<a class="red" href="javascript:;" onclick="return stateyes({$v.admin_id});" title="已开启">
												<div id="zt{$v.admin_id}"><span class="label label-info">开启</span></div>
												</a>
											<else/>
												<a class="red" href="javascript:;" onclick="return stateyes({$v.admin_id});" title="已禁用">
												<div id="zt{$v.admin_id}"><span class="label label-danger">禁用</span></div>
												</a>
											</if>
										</td>
										<td>
											<a href="{:U('admin_list_edit',array('admin_id'=>$v['admin_id']))}" class="btn btn-primary">
												<i class="fa fa-paste"></i> 编辑</a>&nbsp;&nbsp;
											<a onclick="return del({$v.admin_id});" href="javascript:;" class="btn btn-danger demo1">
												<i class="fa fa-trash-o"></i> 删除</a>
										</td>
									</tr>
                                 </foreach>   
							</tbody>
						</table>
					</form>
						<div class="pages" style=" text-align: right;">
							{$page}
						</div>
					</div>
				</div>
			</div>
		</div>
<script>
function del(id){
	if(id==1){
	layer.alert('超级管理员不可删除', {icon: 4});
	return false;
	}
	layer.confirm('你确定要删除吗？', {icon: 3}, function(index){
	layer.close(index);
	window.location.href="__URL__/admin_list_del/admin_id/"+id+"";
	});
}

function stateyes(val){
		  $.post('{:U("admin_list_state")}',
		  {x:val},
	function(data){
	var $v=val;
		if(data.status){
			if(data.info=='状态禁止'){
				var a='<span class="label label-danger">禁用</span>'
				$('#zt'+val).html(a);
				return false;
			}else{
				var b='<span class="label label-info">开启</span>'
				$('#zt'+val).html(b);
				return false;
			}
			
		}
	});
	return false;
}
</script>
		<include file="Public:footer" />
	</body>

</html>



